var test_go=true;

function init(s_time, d_delay, s_id, u_id) {
 delay = s_time;
 counter = 5;
 original = s_time;
 def_delay = d_delay;
 sid = s_id;
 uid = u_id;
 main_go();
}

function main_go() {
   if (test_go) {
      if (counter>=1) {
if(counter>1){
          document.f.m_text.value= + counter-- + " seconds";
}else{
document.f.m_text.value= + counter-- + " second";	
}
timerID=setTimeout("main_go()",1000);
      }
      else {
			$.ajax({
				type: "POST",
				url: "sfreceive.php",
				data: "data="+sid + "---" + uid,    
				success: function(msg){
			document.location.href='surf.php';
			}
			});			
      }
   }
}

function play(){
    if(!test_go){
      test_go=true;
      main_go();
    }
return false;
}

function pause(){
    if (test_go){
       test_go=false;
       document.f.m_text.value=counter;
    }

return false;
}

function open_w(imf){
     window.open(imf);
     return false;
}